package com.hongxun.design.mytools;

import android.content.Context;
import android.net.Uri;
import android.os.Build;

/**
 * Created by zerdoor_pc on 2016/5/11.
 */
public class CheckUtil {
    /**
     * 检测Sdcard是否存在
     *
     * @return
     */
    public static boolean isExitsSdcard() {
        return android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
    }

    /**
     * 通过uri获取文件路径
     *
     * @param mUri
     * @return
     */
    public static String getFilePath(Context context,Uri mUri) {

        String picPath;
        if (Build.VERSION.SDK_INT >= 19) {
            picPath = GetPhotoPathByUrl.getPath(context, mUri);//通过url得到路径
            MyLog.L("photo"+"photoUri===4.4以后 " + picPath);
        } else {
            picPath = GetPhotoPathByUrl.getDataColumn(context, mUri, null, null);
            MyLog.L("photo"+ "photoUri===4.4以前 "+picPath);
        }
        return picPath;

    }
}
